//
//  ZGLShowPicCell.m
//  Faker
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "ZGLShowPicCell.h"
#import <UIImageView+AFNetworking.h>
#import "ZGLPhotoModel.h"


@interface ZGLShowPicCell ()

@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UILabel *wordLabel;

@end

@implementation ZGLShowPicCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _imageV  = [[UIImageView alloc] init];
        _currentPage  =[[UILabel alloc] init];
        _allPage = [[UILabel alloc] init];
        _wordLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_wordLabel];
        [self.contentView addSubview:_imageV];
        [self.contentView addSubview:_currentPage];
        [self.contentView addSubview:_allPage];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    [super applyLayoutAttributes:layoutAttributes];
    [_imageV setFrame:CGRectMake(0, ScaleY * 80, ScaleX * 375, ScaleY * 300)];
    [_currentPage setFrame:CGRectMake(ScaleX * 235, ScaleY * 530, ScaleX * 80, ScaleY * 40)];
    [_allPage setFrame:CGRectMake(ScaleX * 325, ScaleY * 550, ScaleX * 40, ScaleY * 30)];
    [_wordLabel setFrame:CGRectMake(ScaleX * 10, ScaleY * 385, ScaleX * 355, ScaleY * 145)];
    _wordLabel.font = [UIFont systemFontOfSize:14];
    _wordLabel.textColor = artiColor;
    _wordLabel.numberOfLines = 0;
    _currentPage.textAlignment = 2;
    _currentPage.font = [UIFont systemFontOfSize:40];
    _allPage.font = [UIFont systemFontOfSize:20];
}

- (void)setPhotoModel:(ZGLPhotoModel *)photoModel {
    if (_photoModel != photoModel) {
        _photoModel = photoModel;
    }
    [_imageV setImageWithURL:[NSURL URLWithString:photoModel.s_url] placeholderImage:[UIImage imageNamed:@"nopic"]];
    _wordLabel.text = [@"        " stringByAppendingString:photoModel.comment];
}

@end
